﻿// register_dialog.cpp: 实现文件
//

#include "pch.h"
#include "MFCdemo.h"
#include "register_dialog.h"
#include "afxdialogex.h"


// register_dialog 对话框

IMPLEMENT_DYNAMIC(register_dialog, CDialogEx)

register_dialog::register_dialog(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG2, pParent)
{

}

register_dialog::~register_dialog()
{
}

void register_dialog::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT1, user);
	DDX_Control(pDX, IDC_EDIT2, pwd);
	DDX_Control(pDX, IDC_EDIT3, email);
}


BEGIN_MESSAGE_MAP(register_dialog, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON1, &register_dialog::OnBnClickedButton1)
END_MESSAGE_MAP()


// register_dialog 消息处理程序


void register_dialog::OnBnClickedButton1()
{
	wchar_t User[100]{ 0 };
	user.GetWindowTextW(User, 100);

	wchar_t Pwd[100]{ 0 };
	pwd.GetWindowTextW(Pwd, 100);

	wchar_t Email[100]{ 0 };
	email.GetWindowTextW(Email, 100);

	if (!sdk->UserRegister(string_convert::UnicodeToANSI(User),
		string_convert::UnicodeToANSI(Pwd),
		string_convert::UnicodeToANSI(Email),
		"123456"))
	{
		SHOW_MSG(sdk->error_msg.c_str());
		return;
	}
	SHOW_MSG(sdk->sucess_msg.c_str());
}
